<template>
  <!-- 合同信息 -->
  <div id="contractDetail">
    <el-table ref="table" :data="list" row-key="id" stripe style="width: 100%">
      <el-table-column
        label="合同编号"
        prop="num"
        min-width="150"
      ></el-table-column>
      <el-table-column
        label="合同名称"
        prop="name"
        min-width="150"
      ></el-table-column>
      <el-table-column
        label="合同简称"
        prop="simpleName"
        width="200"
      ></el-table-column>
      <el-table-column label="合同类型" prop="typeName" width="200">
      </el-table-column>
      <el-table-column label="合同金额(元)" prop="money" width="200">
      </el-table-column>
      <el-table-column label="签订时间" prop="orderTime" width="250">
      </el-table-column>
      <!-- <el-table-column label="条款" prop="lessorArticle" min-width="150">
      </el-table-column> -->
      <el-table-column label="备注" prop="remark" min-width="150">
      </el-table-column>
    </el-table>
  </div>
</template>
<script>
import { queryTypeByDic } from '@/utils/getData'
export default {
  name: 'contractList',
  data () {
    return {
      contractList: {},
      typeList: []//合同类型列表
    }
  },
  props: {
    list: {
      type: Array,
      required: true,
      default: () => { return [] }
    }
  },
  watch: {
    list (val) {
      if (val) {
        this.contractList = val
        this.typeList.forEach(item => {
          this.contractList.map(c_item => {
            if (item.value == c_item.type) {
              c_item.typeName = item.name
            }
          })
        })
      }
    }
  },
  mounted () {
    this.getContractType()
  },
  methods: {
    // 获取合同类型
    async getContractType () {
      let list = await queryTypeByDic('contractType')
      this.typeList = list
    }
  }
}
</script>
<style lang='scss' scoped>
</style>